/**
 *
 */
package com.naiterui.ehp.bp.bo.patient;

import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.builder.ToStringBuilder;

import java.io.Serializable;
import java.util.Arrays;

/**

 * @since 2.18
 */
public class FamilyBO implements Serializable {
    /**
     * 字段或域定义：<code>serialVersionUID</code>
     */
    private static final long serialVersionUID = 3434328179574404437L;
    /**
     * 家庭成员id
     */
    private Long id;

    /**
     * 患者id
     */
    private Long patientId;
    /**
     * 家庭成员姓名
     */
    private String name;
    /**
     * 家庭成员性别
     */
    private Integer gender;
    /**
     * 家庭成员出生日期
     */
    private Long birth;
    /**
     * 和本人关系:0：父亲；1：母亲；2：兄弟姐妹；3：子女；4：丈夫；5：妻子；6：本人；7：其他家庭成员
     */
    private Integer relation;
    /**
     * 年龄
     */
    private Integer age;
    /**
     * 年龄单位
     */
    private String ageUnit;
    /**
     * 手机号  TODO 本次分支9bcde2bffc45600fd81d184d5120b00f58746b16 没有合并phone
     */
    private String phone;

    public Long getPatientId() {
        return patientId;
    }

    public void setPatientId(Long patientId) {
        this.patientId = patientId;
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Integer getGender() {
        return gender;
    }

    public void setGender(Integer gender) {
        this.gender = gender;
    }

    public Long getBirth() {
        return birth;
    }

    public void setBirth(Long birth) {
        this.birth = birth;
    }

    public Integer getRelation() {
        return relation;
    }

    public void setRelation(Integer relation) {
        this.relation = relation;
    }

    public Integer getAge() {
        return age;
    }

    public void setAge(Integer age) {
        this.age = age;
    }

    public String getAgeUnit() {
        return ageUnit;
    }

    public void setAgeUnit(String ageUnit) {
        this.ageUnit = ageUnit;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    @Override
    public String toString() {
        return ToStringBuilder.reflectionToString(this);
    }

    public enum GenderEnum {

        /**
         * 女
         */
        GENDER_FEMALE(0, "女"),
        /**
         * 男
         */
        GENDER_MALE(1, "男"),
        /**
         * 未知
         */
        GENDER_UNKNOWN(2, "未知");

        private Integer id;
        private String name;

        GenderEnum(Integer id, String name) {
            this.id = id;
            this.name = name;
        }

        public static GenderEnum val(Integer gender) {
            // values()方法返回enum实例的数组
            return Arrays.stream(values()).filter(s -> gender.equals(s.getId())).findFirst().orElse(null);
        }

        public Integer getId() {
            return id;
        }

        public String getName() {
            return name;
        }
    }

    /**
     * 年龄单位
     *

     * @since 2.16
     */
    public enum AgeUnitEunm {
        /**
         * 周
         */
        WEEK("周"),
        /**
         * 个月
         */
        MONTH("个月"),
        /**
         * 岁
         */
        YEAR("岁");
        private String unit;

        AgeUnitEunm(String unit) {
            this.unit = unit;
        }

        public static AgeUnitEunm val(String unit) {
            if (StringUtils.isEmpty(unit)) {
                return null;
            }
            // values()方法返回enum实例的数组
            return Arrays.stream(values()).filter(s -> unit.equals(s.getUnit())).findFirst().orElse(null);
        }

        public String getUnit() {
            return unit;
        }
    }
}
